package com.ftg.learn.chapter04;

/**
 * for
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/6/10 15:56
 */

public class Test04 {

    public static void question02(int index){
        /**
         *  (1+4*9)+(2+6*8)+(3+8*7)+(4+10*6)...
         */
        int n=0;
        for (int i = 1; i <= index; i++) {
            n+=(i+(2*(i+1))*(10-i));
        }
        System.out.println(n);
    }

//    1-5(3)不重复的数
    public static void question03(){
        int[] arr=new int[3];
//        Math.random()*1+1;
        int index=0;
        while (index== arr.length){
            int a=(int)(Math.random()*5)+1;
            if(index==0){
                arr[index++]=a;
            }else {
                boolean ist=false;
                for (int i = 0; i < arr.length; i++) {
                    if(a==arr[i]){
                        ist=true;
                        break;
                    }
                }
                if(!ist){
                    arr[index++]=a;
                }
            }
        }
//        return arr;

    }

    public static void main(String[] args) {
        question02(4);
    }
}
